Skip to content

Conversation

rivkode
Copy link
Member

@rivkode rivkode commented Jul 31, 2025

답안 제출 문제

작성자 체크 리스트

  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

@rivkode rivkode moved this from Solving to In Review in 리트코드 스터디 5기 Aug 1, 2025
Comment on lines +24 to +26
cur = all_multi / v
result.append(int(cur))
elif zero_count == 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요, 이쪽에서 보고 왔습니다 ㅎㅎ #1757 (comment)
zero_count를 통해 0을 예외처리하신 이유는 0으로의 나눗셈에서 예외가 발생하기 때문인데 이 문제는 특히 나눗셈을 하지 말라는 설명이 명시된 것처럼 나눗셈 없는 풀이가 가능해요. 결론적으로 나눗셈 없이 푼다면 0을 예외처리하지 않아도 되겠네요. 왜 나눗셈 없이 풀라고 하는 건지 의아했었는데 예외 처리를 제거할 수 있는 이점을 생각하니 덕분에 납득이 됐습니다. 감사합니다!

Copy link
Member Author

@rivkode rivkode Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아하 ..! 사실,, 저는 저 나눗셈이 영어로 무엇인지 잘 몰랐습니다 .. ㅎㅎ divide가 나누다 이고 operation은 실행 동작 이라고만 알았네요 ㅋㅋㅋ 나눗셈 = division operation 도 함께 배우고 갑니다!

저는 처음 output만 보고 0이라는 특이 케이스가 존재해서 이걸 보고 시도하고 풀어봤는데, 지금 돌이켜보니 이게 되네 ? 였네요 ㅎㅎ

친절한 설명 감사합니다!

Copy link
Member

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다 :)

Comment on lines +8 to +9
for i, v in enumerate(nums):
v_set[v] = i
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 리트코드에서 본 답안 코드를 제출해보셨나요? 이렇게 중복된 값이 여러 번 등장할 때 인덱스를 덮어쓰면 필요한 조합을 놓치거나 잘못된 인덱스를 사용할 수 있을 것 같습니다.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@DaleSeo 주말 일정으로 늦게 답장을 드립니다. 넵! 제출해보았습니다, pass를 하긴 했었는데 많이 느린 편이네요 .. ㅎㅎ

그러네요 .. set을 사용하게 되면 잘못된 인덱스를 사용할 수 있을 것 같습니다. 답이 pass된 이유는 문제에서 다행히 인덱스와는 크게 관련있지 않고 고유한 조합 return 하면 되기때문이었던 것 같습니다. 항상 set으로 인덱스를 사용한다면 덮어씌워지는 부분을 주의해야겠습니다. 감사합니다~!

@rivkode rivkode merged commit 831b097 into DaleStudy:main Aug 3, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 5기 Aug 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

3 participants